<!DOCTYPE html>
<html lang = "en">
<head>
    <meta charset = "UTF-8">
    <title>Title</title>

    <!--=====================================================================-->
    <script>
        //文本提交

        window.onload = function () {
            let oTxt = document.getElementById('txt1');
            let oBtn = document.getElementById('btn1');
            let oTa = document.getElementById('ta');


            //按按钮提交
            oBtn.onclick = function() {
                oTa.value +=oTxt.value+'\n';
                oTxt.value = '';
            };

            //按ctrl+enter提交
            oTxt.onkeydown = function(ev) {
                if (ev.key === 'Enter' && ev.ctrlKey){ //通过ctrlKey来判断是否按下了ctrl
                    oTa.value +=oTxt.value+'\n';
                    oTxt.value = '';        //清空
                }
            }
        }





    </script>
</head>

<body>

<div>

    <input type = "text" id="txt1"><input type = "button" value="提交" id="btn1">
    <br>
    <br>
    <br>
    <textarea rows="10" cols="40" id="ta"></textarea>

</div>

</body>
</html>